<template>
  <div>
    <FormPanel ref="form" :list="formList" :labelPosition="'top'" :labelWidth="130" :cols="3" :isSubmitBtn="false" :collapse="false" />
    <FilterTable ref="table" :columns="columns" :dataSource="tableList" :isMemoryPagination="true" :isSelectColumn="false" height="auto" :onColumnsChange="(columns) => (this.columns = columns)">
      <template slot="controls" slot-scope="props">
        <multiuse-button v-if="type !== 'detail'" size="small" type="primary" @click="openHandle({}, 'demand')">新 增</multiuse-button>
      </template>
    </FilterTable>
    <div v-if="rowData.status === 21461003 || type === 'detail'">
      <FormPanel :list="followUpFormList" :cols="3" :isSubmitBtn="false" :collapse="false" />
      <FilterTable
        ref="tableUp"
        :columns="columnsUp"
        :dataSource="tableListUp"
        :isMemoryPagination="true"
        :isSelectColumn="false"
        height="auto"
        :onColumnsChange="(columns) => (this.columns = columns)"
      >
        <template slot="controls" slot-scope="props">
          <multiuse-button v-if="type !== 'detail'" size="small" type="primary" @click="openHandle({}, 'followUp')">新 增</multiuse-button>
        </template>
      </FilterTable>
    </div>
    <div style="height: 47px"></div>
    <!-- <div class="footer"> -->
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'center',
      }"
    >
      <el-button v-if="type !== 'detail' && rowData.isBind === 10041002 && rowData.status === 21461003" type="primary" :disabled="isShowBindSapCustomerNo" @click="bindSapCustomerNo()"
        >绑定SAP客户编号</el-button
      >
      <el-button v-if="type !== 'detail'" type="primary" :disabled="ischange" @click="closeDrawer('save')">保 存</el-button>
      <el-button v-if="type === 'add' || rowData.status === 21461001" type="primary" :disabled="ischange" @click="closeDrawer('submit')">提 交</el-button>
      <el-button @click="closeDrawer()">关 闭</el-button>
    </div>
    <BaseDialog
      :visible.sync="isAddDetail"
      :title="addDetailType === 'followUp' ? '大客户跟进信息' : '大客户需求信息'"
      destroyOnClose
      :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }"
    >
      <add-detail :type="addDetailType" :rowData="addRormData" @close="closeAddDetail"></add-detail>
    </BaseDialog>
  </div>
</template>
<script>
import { dictionary } from '@/utils/dictMixin';
import config from '@/assets/js/config';
import { IDNumber, phoneAndSolidify, phone, zipCode } from '@/utils/validate';
import { getDetail, matchingSapCustomerNo, bindSapCustomerNo, queryAllSeries, queryAllModelBySeries, saveBigCustomer, submitBigCustomer } from '@/api/omSaleP/KeyCustomers/KeyCustomerInfo/index.js';
import { confirmAction } from '@/utils';
import addDetail from './addDetail.vue';
import moment from 'moment';
export default {
  props: {
    type: {
      type: String,
      require: true,
    },
    rowData: {
      type: Object,
    },
  },
  components: { addDetail },
  data() {
    return {
      formList: this.createdFrom(),
      followUpFormList: [
        {
          type: 'BREAK_SPACE',
          label: '大客户跟进信息',
        },
      ],
      columns: this.createdTable(),
      tableList: [],
      columnsUp: this.createdTableUp(),
      tableListUp: [],
      ischange: false,
      isShowBindSapCustomerNo: true,
      isAddDetail: false,
      addDetailType: 'demand',
      addRormData: {},
      datailData: {},
      current: null,
      demandSeries: [],
      demandModel: [],
    };
  },
  created() {
    //初始化省份数据
    this.initProvince();
    // 查看明细时，禁用
    if (this.type === 'detail') {
      this.formList.forEach((x) => {
        if (x.type !== 'BREAK_SPACE') {
          x.disabled = true;
        }
      });
    }
  },
  mounted() {
    this.table = this.$refs.table.$refs.pageTable;
    //获取所有车系数据
    this.queryAllSeries();
    //初始化页面
    if (this.rowData.id) {
      this.init();
    }
  },
  mixins: [dictionary],
  methods: {
    //初始化页面数据
    async init() {
      const res = await getDetail({ bigCustomerId: this.rowData.id });
      let data = {};
      if (res.resultCode === 200) {
        data = res.data;
        this.datailData = res.data;
      }
      this.formList.map(async (x) => {
        if (x.attachmentType) {
          data[x.fieldName].forEach((item) => {
            item.name = item.attachmentName;
            item.url = item.attachmentUrl;
            item.uid = item.attachmentUuid;
          });
        }
        if (data.provinceId && x.fieldName === 'provinceId') {
          await this.initCity(data.provinceId);
        }
        if (data.cityId && x.fieldName === 'cityId') {
          await this.initRegion(data.cityId);
        }
        x.initialValue = data[x.fieldName];
        //审核通过后大客户名称不可修改
        if (data.status === 21461003 && x.fieldName === 'customersName') {
          x.disabled = true;
        }
      });

      //未绑定SAP客户编号进行匹配
      if (data.isBind != 10041001) {
        this.isShowBindSapCustomerNo = false;
        // const resData = await matchingSapCustomerNo({ credentialsNo: data.credentialsNo });
        // if (resData.resultCode === 200 && resData.data != null) {
        //   data.sapCustomersNo = resData.data;
        // } else {
        //   this.$notify({
        //     title: '警告',
        //     message: '未匹配到SAP客户编号，请填写正确的证件号',
        //     type: 'warning',
        //   });
        // }
      } else {
        //已绑定则禁用编辑
        this.formList.find((item) => item.fieldName == 'credentialsNo').disabled = true;
      }
      this.tableList = data.demandList;
      this.tableList.forEach(async (item) => {
        item.demandSeriesName = this.getName(this.demandSeries, item.demandSeriesId);
        await this.queryAllModelBySeries(item.demandSeriesId);
        item.demandModelName = this.getName(this.demandModel, item.demandModelId);
        this.$forceUpdate();
      });
      this.tableListUp = data.followList;
      this.$forceUpdate();
    },
    changeUpload(val) {
      console.log('45678');
      if (!(val && val.length > 0)) return;
      console.log(val);
      val.forEach(item => {
        const str = item.url.split(item.name);
        if (str.length > 1) {
          item.name += str[1];
        }
      });
      console.log(val);
    },
    //根据证件号获取SAP客户编号
    async getSapCustomerNo(data) {
      if (data) {
        const res = await matchingSapCustomerNo({ credentialsNo: data });
        if (res.resultCode === 200) {
          if (res.data === null) {
            this.$notify({
              title: '警告',
              message: '未匹配到SAP客户编号，请填写正确的证件号',
              type: 'warning',
            });
          }
          this.formList.find((item) => item.fieldName == 'sapCustomersNo').initialValue = res.data;
        } else {
          this.formList.find((item) => item.fieldName == 'sapCustomersNo').initialValue = '';
        }
      }
    },
    // 获取所有车系
    async queryAllSeries() {
      const res = await queryAllSeries();
      if (res.resultCode === 200) {
        this.demandSeries = res.data.map((y) => ({ text: y.seriesName, value: y.seriesId }));
      }
    },
    //根据车系id查询车型
    async queryAllModelBySeries(id) {
      if (id) {
        const res = await queryAllModelBySeries({ pageNum: id });
        if (res.resultCode === 200) {
          this.demandModel = res.data.map((y) => ({ text: y.modelName, value: y.modelId }));
        }
      }
    },
    // 获取车系、车型名称
    getName(list, id) {
      const filterList = list.filter((item) => item.value === id);
      if (filterList.length > 0) {
        return filterList[0].text;
      }
      return '';
    },
    //保存， 提交, 关闭
    async closeDrawer(type = 'close') {
      if (type === 'close') {
        this.$emit('close');
        return;
      }
      let [err, data] = await this.$refs.form.GET_FORM_DATA();
      if (err) return;
      if (this.tableList.length === 0) {
        this.$notify({
          title: '警告',
          message: '请编辑大客户需求信息',
          type: 'warning',
        });
        return;
      }
      this.formList.map((x) => {
        if (x.attachmentType) {
          data[x.fieldName].forEach((item) => {
            item.attachmentName = item.name;
            item.attachmentUrl = item.url;
            item.attachmentUuid = item.uid;
            item.attachmentType = x.attachmentType;
          });
        }
        x.initialValue = data[x.fieldName];
      });
      data.demandList = this.tableList;
      data.followList = this.tableListUp;
      data = { ...this.rowData, ...this.datailData, ...data };
      if (type === 'save') {
        await this.$confirm('是否确认保存大客户报备', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(async () => {
            this.ischange = true;
            this.isShowBindSapCustomerNo = true;
            const resSave = await saveBigCustomer(data);
            if (resSave.resultCode === 200) {
              this.$notify.success({ title: '提示信息', message: '保存成功' });
              this.$emit('close');
            } else {
              this.ischange = false;
              this.isShowBindSapCustomerNo = false;
              return;
            }
          })
          .catch(() => {});
      }
      if (type === 'submit') {
        await this.$confirm('是否确认提交大客户报备', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(async () => {
            this.ischange = true;
            this.isShowBindSapCustomerNo = true;
            const resSubmit = await submitBigCustomer(data);
            if (resSubmit.resultCode === 200) {
              this.$notify.success({ title: '提示信息', message: '提交成功' });
              this.$emit('close');
            } else {
              this.ischange = false;
              this.isShowBindSapCustomerNo = false;
              return;
            }
          })
          .catch(() => {});
      }
    },
    //绑定SAP客户编号
    async bindSapCustomerNo() {
      let [err, data] = await this.$refs.form.GET_FORM_DATA();
      if (err) return;
      console.log(this.rowData);
      if (!this.rowData.id) {
        return;
      }
      data.id = this.rowData.id;
      let waitBindSapCustomerNo = this.formList.find((item) => item.fieldName == 'sapCustomersNo').initialValue;
      if (waitBindSapCustomerNo) {
        await this.$confirm('绑定SAP客户编号后，证件号不可变更。是否确认绑定SAP客户编号', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(async () => {
            this.ischange = true;
            this.isShowBindSapCustomerNo = true;
            const res = await bindSapCustomerNo(data);
            if (res.resultCode === 200) {
              this.$notify.success({ title: '提示信息', message: 'SAP客户编号绑定成功' });
              // this.$emit('close');
              this.ischange = false;
               this.init();
            } else {
              this.ischange = false;
              this.isShowBindSapCustomerNo = false;
              return;
            }
          })
          .catch(() => {});
      } else {
        this.$notify({
          title: '警告',
          message: '未匹配到SAP客户编号，请填写正确的证件号',
          type: 'warning',
        });
      }
    },
    //初始化所在省份
    async initProvince() {
      let pl = await this.createRegionsList();
      this.formList.find((item) => item.fieldName == 'provinceId').itemList = pl;
    },
    //初始化所在市数据
    async initCity(provinceId) {
      //清空市
      this.clearFormItem(this.formList.find((item) => item.fieldName == 'cityId'));
      this.clearFormItem(this.formList.find((item) => item.fieldName == 'districtId'));
      if (!provinceId || provinceId == null || typeof provinceId == 'undefined') {
        return;
      }
      //取城市数据
      let rd = this.createcityList(provinceId);
      this.formList.find((item) => item.fieldName == 'cityId').itemList = rd;
    },
    // 获取区县
    async initRegion(regionId) {
      this.clearFormItem(this.formList.filter((x) => x.fieldName === 'districtId')[0]);
      if (!regionId) return;
      let rd = this.district(regionId);
      this.formList.find((item) => item.fieldName == 'districtId').itemList = rd;
    },
    // 清除
    clearFormItem(item) {
      item.initialValue = undefined;
      item.itemList = [];
    },
    // 删除
    deleteHandle(row, type) {
      confirmAction('是否确认删除')
        .then(() => {
          if (type === 'demand') {
            const index = this.tableList.indexOf(row);
            this.tableList.splice(index, 1);
            this.tableList = [...this.tableList];
          } else {
            const index = this.tableListUp.indexOf(row);
            this.tableListUp.splice(index, 1);
            this.tableListUp = [...this.tableListUp];
          }
          // this.$refs.table.EXECUTE_DELETE(row);
        })
        .catch(() => {});
    },
    // 新增
    openHandle(row, type) {
      this.addRormData = row;
      this.addDetailType = type;
      const index = this.addDetailType === 'demand' ? this.tableList.indexOf(row) : this.tableListUp.indexOf(row);
      this.current = index > -1 ? index : null;
      this.isAddDetail = true;
    },
    // 表格新增数据
    async closeAddDetail(data) {
      if (data) {
        await this.queryAllModelBySeries(data.demandSeriesId);
        data.demandSeriesName = this.getName(this.demandSeries, data.demandSeriesId);
        data.demandModelName = this.getName(this.demandModel, data.demandModelId);
        let tableList = this.addDetailType === 'demand' ? this.tableList : this.tableListUp;
        if (this.current || this.current === 0) {
          tableList[this.current] = data;
          tableList = [...tableList];
        } else {
          tableList = [...tableList, data];
        }
        this.addDetailType === 'demand' ? (this.tableList = tableList) : (this.tableListUp = tableList);
      }
      this.isAddDetail = false;
      this.addRormData = {};
    },
    createdFrom() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '大客户基础信息',
        },
        {
          type: 'INPUT',
          label: '大客户编号',
          fieldName: 'customersNo',
          disabled: true,
        },
        {
          type: 'SELECT',
          label: '大客户来源',
          fieldName: 'customersType',
          disabled: true,
          initialValue: 21081001,
          itemList: this.createDictList('2108'),
        },
        {
          type: 'SELECT',
          label: '大客户类型',
          disabled: true,
          fieldName: 'customerType',
          initialValue: 21171002,
          itemList: this.createDictList('2117'),
        },
        {
          type: 'INPUT',
          label: '大客户名称',
          rules: [{ required: true, message: '请输入', trigger: 'blur' }],
          fieldName: 'customersName',
        },
        {
          type: 'INPUT',
          label: '运营单位联系人',
          rules: [{ required: true, message: '请输入', trigger: 'blur' }],
          fieldName: 'contactsName',
        },
        {
          type: 'INPUT',
          label: '运营单位联系电话',
          rules: [
            { required: true, message: '请输入', trigger: 'blur' },
            { message: '请输入正确的手机号', validator: phone, trigger: 'blur' },
          ],
          fieldName: 'customerPhone',
        },
        {
          type: 'SELECT',
          label: '省份',
          rules: [{ required: true, message: '请选择', trigger: 'change' }],
          fieldName: 'provinceId',
          initialValue: '',
          itemList: [],
          change: (val) => {
            this.initCity(val);
          },
        },
        {
          type: 'SELECT',
          label: '城市',
          rules: [{ required: true, message: '请选择', trigger: 'change' }],
          fieldName: 'cityId',
          initialValue: '',
          itemList: [],
          change: (val) => {
            this.initRegion(val);
          },
        },
        {
          type: 'SELECT',
          label: '县区',
          fieldName: 'districtId',
          placeholder: '',
          initialValue: '',
          itemList: [],
        },
        {
          type: 'INPUT',
          label: '联系地址',
          rules: [{ required: true, message: '请输入', trigger: 'blur' }],
          maxlength: 36,
          fieldName: 'addressName',
          placeholder: '',
        },
        {
          type: 'SELECT',
          label: '证件类型',
          fieldName: 'credentialsType',
          disabled: true,
          initialValue: 21201008,
          itemList: this.createDictList('2120'),
        },
        {
          type: 'INPUT',
          label: '证件号',
          fieldName: 'credentialsNo',
          onInput: (val) => {
            this.getSapCustomerNo(val);
          },
        },
        {
          type: 'INPUT',
          label: '法人代表姓名',
          fieldName: 'legalPersonName',
        },
        {
          type: 'INPUT',
          label: '法人身份证号',
          rules: [{ message: '请输入正确的身份证号', validator: IDNumber, trigger: 'blur' }],
          fieldName: 'legalPersonIdCard',
        },
        {
          type: 'INPUT',
          label: '法人代表手机',
          rules: [{ message: '请输入正确的手机号', validator: phone, trigger: 'blur' }],
          fieldName: 'legalPersonMobile',
        },
        {
          type: 'INPUT',
          label: '授权人身份证号',
          rules: [{ message: '请输入正确的身份证号', validator: IDNumber, trigger: 'blur' }],
          fieldName: 'authorizationPersonIdCard',
        },
        {
          type: 'INPUT',
          label: '传真',
          maxlength: 36,
          fieldName: 'fax',
          placeholder: '',
        },
        {
          type: 'INPUT',
          label: '邮编',
          maxlength: 36,
          rules: [{ message: '请输入正确的邮编', validator: zipCode, trigger: 'blur' }],
          fieldName: 'zipCode',
          placeholder: '',
        },
        {
          type: 'INPUT',
          label: 'SAP客户编号',
          disabled: true,
          fieldName: 'sapCustomersNo',
        },
        {
          type: 'SELECT',
          label: '是否绑定SAP客户编号',
          fieldName: 'isBind',
          disabled: true,
          placeholder: '',
          itemList: this.createDictList('1004'),
          offsetRightCols: 1,
        },
        {
          type: 'BREAK_SPACE',
          label: '',
        },
        {
          type: 'UPLOAD_FILE',
          label: '法人身份证正面',
          fieldName: 'legalPersonIdCodeFrontList',
          placeholder: '请上传法人身份证正面',
          attachmentType: 11131001,
          selfCols: 1,
          initialValue: [],
          // rules: [{ required: true, message: '请上传法人身份证正面', trigger: 'change' }],
          upload: {
            actionUrl: `${config.uploadUrl}/api/file/oss/upload`,
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          change: val => {
            this.changeUpload(val);
          }
        },
        {
          type: 'UPLOAD_FILE',
          label: '法人身份证反面',
          fieldName: 'legalPersonIdCodeReverseList',
          attachmentType: 11131002,
          placeholder: '请上传法人身份证反面',
          selfCols: 1,
          initialValue: [],
          // rules: [{ required: true, message: '请上传法人身份证反面', trigger: 'change' }],
          upload: {
            actionUrl: `${config.uploadUrl}/api/file/oss/upload`,
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          change: val => {
            this.changeUpload(val);
          }
        },
        {
          type: 'UPLOAD_FILE',
          label: '管理员授权文件',
          attachmentType: 11131003,
          fieldName: 'administratorAuthorizationFileList',
          placeholder: '请上传管理员授权文件',
          selfCols: 1,
          initialValue: [],
          // rules: [{ required: true, message: '请上传管理员授权文件', trigger: 'change' }],
          upload: {
            actionUrl: `${config.uploadUrl}/api/file/oss/upload`,
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          change: val => {
            this.changeUpload(val);
          }
        },
        {
          type: 'UPLOAD_FILE',
          label: '授权人身份证正面',
          attachmentType: 11131004,
          fieldName: 'authorizationIdCardFrontList',
          placeholder: '请上传授权人身份证正面',
          selfCols: 1,
          initialValue: [],
          // rules: [{ required: true, message: '请上传授权人身份证正面', trigger: 'change' }],
          upload: {
            actionUrl: `${config.uploadUrl}/api/file/oss/upload`,
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          change: val => {
            this.changeUpload(val);
          }
        },
        {
          type: 'UPLOAD_FILE',
          label: '授权人身份证反面',
          attachmentType: 11131005,
          fieldName: 'authorizationIdCardReverseList',
          placeholder: '请上传授权人身份证反面',
          selfCols: 1,
          initialValue: [],
          // rules: [{ required: true, message: '请上传授权人身份证反面', trigger: 'change' }],
          upload: {
            actionUrl: `${config.uploadUrl}/api/file/oss/upload`,
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          change: val => {
            this.changeUpload(val);
          }
        },
        {
          type: 'UPLOAD_FILE',
          label: '营业执照',
          fieldName: 'businessLicenseList',
          attachmentType: 11131006,
          placeholder: '请上传营业执照',
          selfCols: 1,
          initialValue: [],
          // rules: [{ required: true, message: '请上传营业执照', trigger: 'change' }],
          upload: {
            actionUrl: `${config.uploadUrl}/api/file/oss/upload`,
            fixedSize: [5, 3],
            limit: 1,
            isCalcHeight: true,
          },
          change: val => {
            this.changeUpload(val);
          }
        },
        {
          type: 'BREAK_SPACE',
          label: '大客户需求信息',
        },
      ];
    },
    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 100,
          fixed: 'left',
          hidden: this.type === 'detail',
          render: (props, h) => {
            return (
              <div>
                <multiuse-button size="mini" type="text" onClick={() => this.deleteHandle(props.row, 'demand')}>
                  删除
                </multiuse-button>
                <multiuse-button size="mini" type="text" onClick={() => this.openHandle(props.row, 'demand')}>
                  编辑
                </multiuse-button>
              </div>
            );
          },
        },
        {
          title: '需求车系',
          dataIndex: 'demandSeriesId',
          sorter: true,
          filter: true,
          filterType: 'input',
          render: (p) => {
            return <span>{p.row.demandSeriesName}</span>;
          },
        },
        {
          title: '需求车型',
          dataIndex: 'demandModelId',
          sorter: true,
          filter: true,
          filterType: 'input',
          render: (p) => {
            return <span>{p.row.demandModelName}</span>;
          },
        },
        {
          title: '需求数量',
          dataIndex: 'demandNum',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '预计采购时间',
          dataIndex: 'expectPurchaseDate',
          sorter: true,
          filter: true,
          filterType: 'date-range',
          dateFormat: 'yyyy-MM-dd',
        },
        {
          title: '采购方式',
          dataIndex: 'purchaseType',
          sorter: true,
          filter: true,
          filterType: 'input',
          render: (p) => {
            return <span>{this.createDictText(p.row.purchaseType, '2142')}</span>;
          },
        },
        {
          title: '预计采购价格',
          dataIndex: 'expectPurchasePrice',
          sorter: true,
          filter: true,
          precision: 2,
          numberFormat: true,
          align: 'right',
          filterType: 'input',
        },
        {
          title: '市场指导价',
          dataIndex: 'marketDirectivePrice',
          sorter: true,
          filter: true,
          precision: 2,
          numberFormat: true,
          align: 'right',
          filterType: 'input',
        },
      ];
    },
    createdTableUp() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: (props) => {
            return <span>{props.row.index + 1}</span>;
          },
        },
        {
          title: '操作',
          dataIndex: 'column-action',
          width: 100,
          fixed: 'left',
          hidden: this.type === 'detail',
          render: (props, h) => {
            let html = null;
            if (!props.row.id) {
              html = (
                <div>
                  <multiuse-button size="mini" type="text" onClick={() => this.deleteHandle(props.row, 'followUp')}>
                    删除
                  </multiuse-button>
                  <multiuse-button size="mini" type="text" onClick={() => this.openHandle(props.row, 'followUp')}>
                    编辑
                  </multiuse-button>
                </div>
              );
            } else {
              html = <div></div>;
            }
            return html;
          },
        },
        {
          title: '意向级别',
          dataIndex: 'intentionType',
          sorter: true,
          filter: true,
          filterType: 'input',
          render: (p) => {
            return <span>{this.createDictText(p.row.intentionType, '2143')}</span>;
          },
        },
        {
          title: '跟进结果',
          dataIndex: 'followResultType',
          sorter: true,
          filter: true,
          filterType: 'input',
          render: (p) => {
            return <span>{this.createDictText(p.row.followResultType, '2144')}</span>;
          },
        },
        {
          title: '跟进时间',
          dataIndex: 'followDate',
          sorter: true,
          filter: true,
          filterType: 'input',
          dateFormat: 'yyyy-MM-dd',
        },
        {
          title: '跟进方式',
          dataIndex: 'followType',
          sorter: true,
          filter: true,
          filterType: 'input',
          render: (p) => {
            return <span>{this.createDictText(p.row.followType, '2145')}</span>;
          },
        },
        {
          title: '跟进内容',
          dataIndex: 'followContent',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '跟进人',
          dataIndex: 'followPersonName',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '预计下次跟进时间',
          dataIndex: 'nextFollowDate',
          sorter: true,
          filter: true,
          filterType: 'input',
          dateFormat: 'yyyy-MM-dd',
        },
      ];
    },
  },
};
</script>
<style lang="scss">
.footer {
  position: 'absolute';
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 9;
  border-top: '1px solid #e9e9e9';
  padding: '10px 20px';
  background: '#fff';
  text-align: 'right';
  padding: 20px 30%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-around;
}
.upload-btn {
  width: 100%;
}
.el-upload-list__item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  padding-right: 20px;
  box-sizing: border-box;
}
</style>
